import request from '@/utils/request'

// 获得列表
/* 
  @ param  any
     作为需要向后端传递的参数
     注意 get param
         post  body
*/
let getSpots = async (params) => {
    let result = await request({
        method: 'GET',
        url: '/spots/getSpotsList',
        params: {
            ...params,
            role: "spots"
        }
    })
    return result
}
let findSpotsByID = async (params) => {
    let result = await request({
        method: 'post',
        url: '/spots/getSpotsListByID',
        data: {
            ...params,
            role: "spots"
        }
    })
    return result
}
let delSports = async (params) => {
    let result = await request({
        method: 'post',
        url: '/spots/delSpotsById',
        data: {
            ...params,
            role: "spots"
        }
    })
    return result
}

let updateSpots = async (params) => {
    console.log(params);
    let result = await request({
        method: 'post',
        url: '/spots/updateSpots',
        data: {
            ...params,
            role: "spots"
        }
    })
    return result
}

let addSpots = async (params) => {
    let result = await request({
        method: 'post',
        url: '/spots/addSpots',
        data: {
            ...params,
            role: "spots"
        }
    })
    return result
}

export default {
    getSpots,
    delSports,
    updateSpots,
    addSpots,
    findSpotsByID
}